Ext.define('Emp.view.operator.List', {
	extend: 'Emp.view.BaseList',
	alias: 'widget.operatorlist',
	
	requires: [
		'Emp.store.Operator',
		'Emp.ux.toolbar.GridToolbar',
		'Emp.ux.toolbar.Paging',
	],
	
	initComponent: function() {
		var gridStore = Ext.create('Emp.store.Operator', {
			listeners: {
				scope: this,
				'beforeload': this.doBeforeLoad,
        		'load': this.doLoad
			}
		});
		this.grid = Ext.create('Ext.grid.Panel', {
			store: gridStore,
			selModel: Ext.create('Ext.selection.CheckboxModel'),
			columns: [{
					xtype: 'rownumberer',
					width: 40
				}, {
					header: 'id',
					dataIndex: 'id',
					hidden: true,
					hideable: false
				}, {
					header: '操作名称',
					dataIndex: 'name',
					flex: 2
				}, {
					header: '显示文本',
					dataIndex: 'text',
					flex: 2
				}, {
					header: '图标',
					dataIndex: 'iconCls',
					flex: 2
				}, {
					header: '状态',
					dataIndex: 'status',
					renderer: function(value) {
						return value === 'enable' ? '启用' : '停用';
					},
					flex: 1
				}, {
					header: '排序',
					dataIndex: 'sort',
					flex: 1
			}],
			dockedItems:[{
					xtype: 'gridtoolbar',
					dock: 'top'
				}, {
					xtype: 'paging',
					store: gridStore,
					dock: 'bottom',
        			displayInfo: true
			}]
		});
		Ext.apply(this, {
			layout: 'fit',
			items: [this.grid]
		});
		this.callParent();
	}
});